using System;
using System.IO;
using System.Windows;
using System.Text;
using System.Collections.Generic;

namespace Qplus.Commands
{

    /**
     * 
     *
     */
    public class GetOtherAppCommand : AbsHeaderHttpCommand , HttpInputStreamProcessor{

	    const string COMMAND = "GetOtherApp";
	    Boolean needUp = true;
	    /**
	     * @param uid
	     * @param UKEY
	     */
	    public GetOtherAppCommand(String uid, String UKEY)
            : base(COMMAND, uid, UKEY)
        {
	    }
	
	    /**
	     * @param uid
	     * @param UKEY
	     */
	    public GetOtherAppCommand(long uid, byte[] UKEY)
            : base(COMMAND, Convert.ToString(uid)/*uid.GetType().ToString(),*/, Encoding.UTF8.GetString(UKEY, 0, 32))
        {
		    
	    }
	
	    public void set(long appID, List<String> appList){
		    if(appList == null || appList.Count == 0){
			    needUp = false;
			    return;
		    }
		    setAppList(appID, appList);
	    }
	
	    private void setAppList(long appID, List<String> apps){
	
	    }

	    
	    public override Boolean processInputStream(Stream responseStream) {
		    return true;
	    }

	    
	    public override void onSuccess(int code) {
	    }

        public override void onFailed(int code)
        {
	    }
	
	    public HttpTask execute(String url) {
		    if(!needUp){
			    return null;
		    }
		    return base.execute(url, this);
	    }
    }
}
